/*      > H.Set - Set data type header file */

#ifndef __set_h

#define __set_h

struct set
{
        void *first;    /* pointer to first element of set */
        int obj_size;   /* size of one element */
};

typedef struct set *set;

/* General component routines */

set set_new (int obj_len);
void set_free (set s);
void set_clear (set s);
int set_copy (set s1, const set s2);
int set_equal (const set s1, const set s2);
int set_empty (const set s);
int set_size (const set s);

/* Iterator */

#define STATUS_CONTINUE 0       /* Continue processing */
#define STATUS_STOP     1       /* Stop processing */
#define STATUS_ERROR    (-1)    /* Error - terminate */

int set_iterate (const set s, int (*process)(void *));

/* Set-specific routines */

int set_add (set s, const void *object);
int set_remove (set s, const void *object);
int set_member (const set s, const void *object);
int set_union (set s, const set t, const set u);
int set_intersection (set s, const set t, const set u);
int set_difference (set s, const set t, const set u);
int set_subset (const set s1, const set s2);
int set_proper_subset (const set s1, const set s2);

#endif
